package com.users.dao;

import com.common.dao.AbstractDao;
import com.users.entities.User;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;


/**
 * @author fu
 */
public interface UserDao extends AbstractDao<User, Long> {

    @Transactional
    @Modifying
    @Query(value = "update  User u set u.password=?2 where u.id=?1")
    int updatePasswordById( Long id, String password );

    @Transactional
    @Modifying
    @Query(value = "update  User u set u.tel=?1 where u.id=?2")
    Integer updateImgByUserId( String url, Long id );

    User findUserByUsername( String username );
//    User findUserByUsernameAndPassword(String username,String password);
}
